#ifndef MSELECTOR_H
#define MSELECTOR_H

#include <QGraphicsWidget>
#include <QTimer>

#include "mselection.h"

class MSelector : public QGraphicsWidget
{
    Q_OBJECT
public:
    explicit MSelector(QGraphicsItem *parent = 0);
    
protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

signals:

    void newSelection(int l, int u, int r, int d);
    void endSelection();
    void moveOver(int x, int y);
    
public slots:

    void timer();
private:

    int start_x, start_y, end_x, end_y;
    bool is_down;

    MSelection *sel;
    QTimer *tm;
};

#endif // MSELECTOR_H
